-
Notifications
You must be signed in to change notification settings - Fork 216
Implement Sparse Checkout for GitRepository
#1774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
72d3852 to
7035a58
Compare
GitRepository
@dipti-pai I think we should handle this on our own. We could trim |
7035a58 to
7565fa8
Compare
|
From the abnormal behaviours called out, I'd agree with @stefanprodan on For |
Yes we could verify the dirs and error out in the controller 👍 |
|
Updated the code to handle incorrect user configuration where Once the error in configuration is fixed, the reconciliation succeeds - |
7565fa8 to
d1d2461
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @dipti-pai 🏅
d1d2461 to
32e40e0
Compare
- Add `.spec.sparseCheckout` and `.status.observedSparseCheckout` fields to `GitRepository`.
- Add controller support to send the sparse checkout directories to go-git via pkg methods.
- Use `.status/observedSparseCheckout` to detect drift in configuration.
- Trim leading "./" in directory paths.
- Validate spec configuration by checking directories specified in spec exist in the cloned repository after successful checkout
- Add tests for testing the observed sparse checkout behavior.
- Add docs describing the new fields.
Signed-off-by: Dipti Pai <[email protected]>
32e40e0 to
61f9eb2
Compare
Sparse Checkout Directories in GitRepositories.
Fixes: #1707
Current behavior worth calling out.
.spec.sparseCheckoutdirectory list includes a directory that does not exist, the underlying go-git checkout method does not return an error and silently continues. See SparseCheckoutDirectories behavior when directory path does not exist go-git/go-git#1500 . This is being handled in the controller..spec.sparseCheckoutdirectory list includes directory with more than one level of nesting, sparse checkout is not honored and all directories at top-level are checked out. Will be fixed bySparseCheckoutDirectoriesworks only for 1st level directory. go-git/go-git#1455.spec.sparseCheckoutuses relative path beginning with a./, the path is ignored and nothing is checked out and no errors are thrown. SeeSparseCheckoutDirectoriesignores relative paths beginning with (./) while checking out git repository go-git/go-git#1506 . This is being handled in source-controller.4.. If
.spec.sparseCheckoutincludes an empty directory, the entire repository is checked out (Expected)